#ifndef DENSEGRADEWRAPPER_H
#define DENSEGRADEWRAPPER_H

#include <QDebug>
#include <QObject>

#include <time.h>
#include <math.h>

#include <openvino/openvino.hpp>
#include <opencv2/opencv.hpp>

#include "Network/DebugTools.h"
#include "Network/NetworkTools.h"

typedef struct {
    int index;
    float pie[5];
}DenseInferResult;

class DenseGradeWrapper : public QObject
{
    Q_OBJECT
public:
    explicit DenseGradeWrapper(QString xmlPath, QObject *parent = nullptr);

public:
    DenseInferResult infer(QString imageSrc);

private:
    // infer process
    QVector<float> _infer(cv::Mat transDim);

    // post process
    void softmax(QVector<float> &buffer);
    DenseInferResult postProcess(const QVector<float> &buffer);

    // pre process
    cv::Mat preprocess(QString imageSrc);
    cv::Mat circleCrop(QString imageSrc);

private:
    std::shared_ptr<ov::Model> xmlModel;
    ov::CompiledModel compiledModel;
};

#endif // DENSEGRADEWRAPPER_H
